//
//  WXComposeButton.swift
//  weibo
//
//  Created by 王旭 on 16/4/25.
//  Copyright © 2016年 王旭. All rights reserved.

//自定义菜单按钮

import UIKit

class WXComposeButton: UIButton {
    
//重写高亮属性->去除高亮状态
    override var highlighted:Bool {
        set{
            
        }get{
            return false
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
//布局界面
    func setupUI() {
        //设置文本对齐方式
        titleLabel?.textAlignment = .Center
        //设置图片显示显示
        imageView?.contentMode = .Center
    }
    
//修改按钮内的控件位置
    override func layoutSubviews() {
        super.layoutSubviews()
        //图片框
        imageView?.frame = CGRect(x: 0, y: 0, width: frame.width, height: frame.width)
        //label
        titleLabel?.frame = CGRect(x: 0, y: frame.width, width: frame.width, height: frame.height - frame.width)
    }

}
